package com.tubruk.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.tubruk.object.ConstantList;
import com.tubruk.trackme.R;

public class ConstantListAdapter extends ArrayAdapter<ConstantList> {
	private ArrayList<ConstantList> items;
	private LayoutInflater vi;
	
	public ConstantListAdapter(Context context, int textViewResourceId, ArrayList<ConstantList> items) {
        super(context, textViewResourceId, items);
        this.items = items;
        vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        
	}
	
	@Override
    public View getView(int position, View convertView, ViewGroup parent) {
		View v = convertView;
	
		ConstantList item = items.get(position);
		
		if (v == null){
			v = vi.inflate(R.layout.constantlist, null);
		}
		
		TextView tv = (TextView) v.findViewById(R.id.title);
		tv.setText(item.getTitle());
		
		
		return v;
	}
}
